<template>
  <div class="datacard-container">
    <div class="icon-container" :style="`color: ${iconColor}`">
      <svg-icon :icon-class="icon" size="3em"></svg-icon>
    </div>
    <div>
      <div class="datacard-title">
        {{ title }}
      </div>
      <div class="datacard-num">
        <count-to
          :startVal="startVal"
          :endVal="endVal"
          :duration="3000"
        ></count-to>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { defineProps } from "vue";
import { CountTo } from "vue3-count-to";
import SvgIcon from "@/components/SvgIcon/index.vue";

defineProps({
  startVal: {
    type: Number,
    default: 0,
  },
  endVal: {
    type: Number,
    default: 100,
  },
  duration: {
    type: Number,
    default: 3000,
  },
  icon: {
    type: String,
  },
  iconColor: {
    type: String,
  },
  title: {
    type: String,
  },
});
</script>

<style scoped lang="scss">
.datacard-container {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  font-weight: bold;
  color: var(--el-text-color-regular);
  background: var(--el-bg-color-overlay);
  border-color: var(--el-border-color);
  box-shadow: var(--el-box-shadow-dark);
  margin-bottom: 20px;
  .datacard-title {
    color: var(--el-text-color-secondary);
  }
  .datacard-num {
    margin-top: 10px;
  }
}
</style>
